#pragma once
#include <map>
#include <string>
#include <pthread.h>
#include <time.h>

class BBS2chProxyBoardManager {
private:
	std::map<std::string, std::string> _boardToServer;
	pthread_mutex_t _mutex;
	time_t _lastUpdated;
	void updateMap();
public:
	BBS2chProxyBoardManager() : _lastUpdated(0) {
		pthread_mutex_init(&_mutex, NULL);
	}
	~BBS2chProxyBoardManager() {
		pthread_mutex_destroy(&_mutex);
	}
	std::string getServerForBoard(const std::string &name);
	std::string getBoardJSONForTalkAndFake5ch();
	std::string getBoardHTML(bool shouldUseHttp, bool shouldUse2ch, bool shouldIncludeTalk);
	std::string getBoardJSON(bool shouldUseHttp, bool shouldUse2ch, bool shouldIncludeTalk);
};
